<template>
    <!-- //播放 -->
        <div class="player">
      <!-- autoplay 自动播放 -->
      <audio :src='musicUrl' controls autoplay class="player_audio" ></audio>
    </div>
</template>
<script>
export default {
    name:'Bofang',
    data(){
        return{
            musicUrl:''
        }
    },
    methods:{
      playMusic(id) {
        axios({
          url: 'http://localhost:3000/song/url',
          method: 'get',
          params: {
            id // id:id
          }
        }).then(res => {
          // console.log(res)
          let url = res.data.data[0].url
          //  console.log(this.$parent.musicUrl)
          // 设置给父组件的 播放地址
          this.musicUrl = url
        })
      }
    }
}
</script>
<style>
.player {
  background: rgb(36, 36, 36);
  height: 40px;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
}
.player_audio {
  margin-left:35%;
  width: 20%;
  height: 100%;
}
</style>